Skip to content

Switch parser to langlang v0.0.12 Go output - #17

Merged
jeffersonmourak merged 11 commits into
mainfrom
langlang-upgrade
May 21, 2026
Merged

Switch parser to langlang v0.0.12 Go output#17
jeffersonmourak merged 11 commits into
mainfrom
langlang-upgrade

Conversation

@jeffersonmourak

@jeffersonmourak jeffersonmourak commented May 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Moves the parser from the unmerged langlang c-output branch to the tagged v0.0.12 release; the version pin is now a real released artifact rather than a moving commit.
  • Replaces 1707 lines of generated C with a langlang Go parser plus a 141-line CGo shim, linked into Zig as a static c-archive.
  • Engine bench reports golden matches on every counter and topology hash; the IR is byte-identical to the previous C parser path.
  • Adds --verbose on --truth-table, default-suppressing the engine's per-event info(log) traces so the markdown table on stdout stays clean.
  • Reconciles README install instructions, DOCS/decisions/tooling.md (new CGo bridge decision section), and parser-layout references across architecture / circuit-format docs.

Test plan

  • zig build test (full suite, including new args tests)
  • zig build bench (golden matches)
  • circ-compile <input>.circ -o <output>.wasm produces a working artifact
  • circ-compile <input>.circ --truth-table emits markdown on stdout, stderr is silent
  • circ-compile <input>.circ --truth-table --verbose shows engine traces on stderr
  • circ-compile <input>.circ --inspect --verbose rejects with a usage error

…plementation

- Changed the parser generation step in `build.zig` to produce a Go parser instead of a C parser.
- Introduced a new `parser.go` file containing the generated Go parser code, implementing the necessary structures and methods for parsing.
- Updated output paths and command options to align with Go conventions, including package naming and file structure.
- Introduced a new Go module for the parser with `go.mod` file.
- Added `shim.go` to expose the parser as a C-callable interface, enabling integration with Zig.
- Updated `.gitignore` to include new parser files and directories.
- Introduced a new build step in `build.zig` to create a CGo c-archive for the Go parser implementation.
- Added a system command to build the Go shim as a static library, ensuring proper integration with Zig.
- Updated dependencies to reflect the new build process for the parser archive.
- Added environment variables for cross-compilation in `build.zig` to ensure compatibility with Zig target architecture and OS.
- Updated the C interface in `CParser.zig` to include the correct header path for the Go parser.
- Refactored `translate.zig` to utilize the new Go API, replacing C parser references with Go-compatible types and functions.
- Streamlined the parser library linking process in the benchmark executable to use the updated static library.
- Deleted the C parser implementation file `parser.c` and its corresponding header file `parser.h`.
- This change reflects the transition to a Go-based parser, aligning with recent updates to the parser architecture and integration with Zig.
…ents

- Revised README to include Go as a prerequisite for building the langlang-generated parser and clarified the role of langlang in parser regeneration.
- Updated architecture documentation to reflect the transition to a Go-based parser and the new CGo c-archive integration.
- Enhanced circuit format documentation to describe the Go parser and its interface with Zig.
- Added details about the new `--verbose` flag in CLI arguments, allowing users to enable detailed engine logs during truth table simulations.
- Introduced a new function `linkParserArchive` to simplify the linking of the Go parser c-archive into the build process.
- Removed the previous static library linking approach for the parser, allowing the linker to handle the archive directly.
- Updated multiple test artifacts to utilize the new linking function, ensuring consistency across the build steps.
- Introduced a new GitHub Actions workflow for end-to-end (E2E) testing, triggered manually or by the `e2e-required` label on pull requests.
- Configured the workflow to run the full Zig test suite, including WASM tests, and validate the Linux Docker E2E process.
- Set up environment variables and dependencies for Zig, Node, and Go to ensure a consistent testing environment.
- This workflow complements the existing PR tests by providing a more comprehensive testing approach.
@jeffersonmourak jeffersonmourak added the e2e-required Require all tests to run label May 21, 2026
- Updated the GitHub Actions E2E testing workflow to include two parallel jobs: `wasm-e2e` and `docker-e2e`.
- The `wasm-e2e` job runs the full Zig test suite without skipping WASM tests, explicitly surfacing known failures.
- The `docker-e2e` job cross-compiles the Zig project for Linux ELF and validates the distribution process in a Docker container.
- Improved documentation within the workflow file to clarify job purposes and expected outcomes.
- Deleted the GitHub Actions E2E testing workflow file `.github/workflows/e2e-tests.yml`.
- This removal reflects a decision to streamline CI processes and may indicate a shift in testing strategy or reliance on alternative testing methods.
@jeffersonmourak jeffersonmourak removed the e2e-required Require all tests to run label May 21, 2026
- Updated the build process in `build.zig` to set the C compiler environment variable to `zig cc -target <triple>`, ensuring compatibility for cross-building from macOS.
- This change addresses issues with compiling Linux-specific C code when using the host's clang, enhancing the hermeticity of both native and cross-builds.
@jeffersonmourak
jeffersonmourak merged commit 0aaefe1 into main May 21, 2026
3 checks passed
@jeffersonmourak
jeffersonmourak deleted the langlang-upgrade branch May 21, 2026 22:33
This was referenced May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant